<template>
  <div class="top">
    <van-icon name="arrow-left" class="icon" @click="$router.go(-1)" />
    <div class="searchbox">
      <div class="box">
        <van-search
          v-model="value"
          clearable
          shape="round"
          placeholder="请输入搜索关键词"
          class="box2"
        />
      </div>
    </div>
    <van-icon name="ellipsis" class="icon" />
  </div>
</template>

<script>
export default {
  data() {
    return {
      value: "",
      headerActive: false,
    };
  },
  methods: {
    changeBg() {
      let scollTop =
        window.pageXOffset ||
        document.documentElement.scrollTop ||
        document.body.scrollTop;
      scollTop > 100 ? (this.headerActive = true) : (this.headerActive = false);
    },
  },
  mounted() {
    window.addEventListener("scroll", this.changeBg);
  },
};
</script>

<style lang="scss" scoped>
.top {
  position: fixed;
  left: 0;
  top: 0;
  display: flex;
  justify-content: space-between;
  height: 100px;
  z-index: 998;
  width: 100%;
  padding: 0 30px;
  border-bottom: 1px solid #dcdcdc;
  box-sizing: border-box;
  align-items: center;
  background-color: #fff;
}
.icon {
  font-size: 50px;
}
.searchbox {
  display: flex;
  // background-color: #fff;
  border-radius: 40px;
  padding: 0 37.5px;
  align-items: center;
  width: 100%;
  margin: 0 10px;
}
.s1 {
  display: inline-block;
  font-size: 40px;
  font-weight: 700;
  color: red;
  padding-right: 10px;
  border-right: 1px solid #000;
}
.van-search {
  padding: 0;
}
.box {
  width: 100%;
  // background-color: #fff;
}

.bg {
  background-color: #f63515;
}
</style>